from django.db import models
from django.utils.translation import gettext_lazy as _


class ShareFile(models.Model):
    file_name = models.CharField(verbose_name=_('文件名称'), max_length=255, null=True, blank=True)
    file = models.FileField(verbose_name=_('文件'), upload_to='media/oa/%Y%m/')

    datetime_created = models.DateTimeField(verbose_name=_('创建时间'), auto_now_add=True)
    datetime_updated = models.DateTimeField(verbose_name=_('更新时间'), auto_now=True)

    objects = models.Manager()

    class Meta:
        ordering = ['-id']
        verbose_name = _('共享文档')
        verbose_name_plural = verbose_name

    def __str__(self):
        return "{0}".format(self.file_name)
